<template>
	<layout :loading="loading" curPage="servicer" :title="data.id ? '修改运维公司':'新增运维公司'">
	
		<form class="layui-form" @submit="submit" data-action="/admin/servicer/save" data-rediret="/pages/servicer/servicerList">
			
			<inputGroup type="text" title="公司名称" name="x.name|公司名称|0~100" :value="data.name"  placeholder="请输入公司名称"></inputGroup>
			<inputGroup type="text" title="公司地址" name="x.address|公司地址|0~100" :value="data.address"  placeholder="请输入公司地址"></inputGroup>
			
			<inputGroup type="text" title="联系人" name="x.contacts|联系人|0~50" :value="data.contacts"  placeholder="请输入联系人"></inputGroup>
			
			<inputGroup type="number" title="手机号码" name="x.mobile|手机号码|mobile" :value="data.mobile"  placeholder="请输入手机号码"></inputGroup>
			
			<inputGroup type="text" title="备注" name="x.remark|备注|0~200|empty" :value="data.remark"  placeholder="选填"></inputGroup>
			
			<inputGroup type="text" title="营业执照号" name="x.license|营业执照号|0~200|empty" :value="data.license"  placeholder="选填"></inputGroup>
			
			<uploadPic title="营业执照照片" name="x.licensePic|营业执照照片|empty" :value="data.licensePic" :count="1"></uploadPic>
			
			<uploadPic title="资质证书" name="x.authPic|资质证书|empty" :value="data.authPic" :count="999"></uploadPic>
			
			
			<div class="layui-form-item">
				<div class="layui-input-block" style="margin-left: 140px;">
					<input type="hidden" name="x.id" :value="data.id" style="display: none;">
					<button class="layui-btn" form-type="submit">{{ !data.id ? '保存' : '修改'}}</button>
					<button class="layui-btn layui-btn-primary" @click="kit.goBack('index')">取消</button>
				</div>
			</div>
		</form>

	</layout>
</template>

<script>
	export default {
		data() {
			return {
				loading: true ,
				data : {
					id : ''
				}
			}
		},
		onLoad(params) {
			this.data.id = params.id || "" ;
			this.loadData();
		},
		onShow() {
			
		},
		methods: {
			
			submit:function(e){
				this.form.submit(e);
			},
			
			loadData : function(e){
				var that = this ;
				var data = {
					id : this.data.id
				} ;
				this.kit.get("/admin/servicer/info",data,function(res){
					that.data = res.data || that.data ;	
					that.loading  = false ;
				});
			}
		}
	}
</script>